$OpenBSD: patch-base_process_process_posix_cc,v 1.9 2017/04/28 14:21:00 robert Exp $
--- base/process/process_posix.cc.orig.port	Wed Apr 19 21:06:28 2017
+++ base/process/process_posix.cc	Thu Apr 27 19:55:58 2017
@@ -8,6 +8,7 @@
 #include <stdint.h>
 #include <sys/resource.h>
 #include <sys/wait.h>
+#include <signal.h>
 
 #include "base/debug/activity_tracker.h"
 #include "base/files/scoped_file.h"
@@ -23,6 +24,9 @@
 
 namespace {
 
+const int kBackgroundPriority = 5;
+const int kForegroundPriority = 0;
+
 #if !defined(OS_NACL_NONSFI)
 
 bool WaitpidWithTimeout(base::ProcessHandle handle,
@@ -257,12 +261,10 @@ Process Process::DeprecatedGetProcessFromHandle(Proces
   return Process(handle);
 }
 
-#if !defined(OS_LINUX) && !defined(OS_MACOSX)
 // static
 bool Process::CanBackgroundProcesses() {
-  return false;
+  return true;
 }
-#endif  // !defined(OS_LINUX) && !defined(OS_MACOSX)
 
 // static
 void Process::TerminateCurrentProcessImmediately(int exit_code) {
@@ -366,21 +368,23 @@ bool Process::WaitForExitWithTimeout(TimeDelta timeout
   return WaitForExitWithTimeoutImpl(Handle(), exit_code, timeout);
 }
 
-#if !defined(OS_LINUX) && !defined(OS_MACOSX)
 bool Process::IsProcessBackgrounded() const {
   // See SetProcessBackgrounded().
   DCHECK(IsValid());
-  return false;
+  return GetPriority() == kBackgroundPriority;
 }
 
-bool Process::SetProcessBackgrounded(bool value) {
-  // Not implemented for POSIX systems other than Linux and Mac. With POSIX, if
-  // we were to lower the process priority we wouldn't be able to raise it back
-  // to its initial priority.
-  NOTIMPLEMENTED();
-  return false;
+bool Process::SetProcessBackgrounded(bool background) {
+  DCHECK(IsValid());
+   
+  if (!CanBackgroundProcesses())
+    return false;
+
+  int priority = background ? kBackgroundPriority : kForegroundPriority;
+  int result = setpriority(PRIO_PROCESS, process_, priority);
+  DPCHECK(result == 0);
+  return result == 0;
 }
-#endif  // !defined(OS_LINUX) && !defined(OS_MACOSX)
 
 int Process::GetPriority() const {
   DCHECK(IsValid());
